*****Conscription and Military Service: Do They Result in Future Violent and Non-Violent Incarcerations and Recidivism?  Wang, Flores-Lagunes 2020*****
****This do-file prints the results for Appendix D1
clear all

cd "C:\Users\xinto\Dropbox\Vietnam Veteran Paper\Crime Paper\2020 JHR Data\12. Table D1"
set matsize 1000
set more off 

do CLR_01272015.ado

global outcomes1="currentViolent violent_desistence"
global outcomes2="nonviolent_new nonviolent_desistance"
global outcomes="currentViolent nonviolent_new violent_desistence nonviolent_desistance"

/*
use vc_nonviolent_desistance_ygroup2_white_nonwhite_test_I2_be, clear
qui bstat using vc_nonviolent_desistance_ygroup2_white_nonwhite_test_I2_be
set more off

estat bootstrap,per

matrix b = e(b)
mat list b
*/

*Panel 1. Extract bounds estimates from the bootstrapped data 

foreach race in 1 0 {

local i=1	
	
foreach outcome in $outcomes1 {
   
           
use vc_`outcome'_ygroup1_white`race'_I2_be, clear
qui bstat using vc_`outcome'_ygroup1_white`race'_I2_be
set more off

estat bootstrap,per

matrix b = e(b)
mat list b

matrix Vb = e(V)
matrix se = e(se)

sca N=b[1,12]
sca list N
set more off

*P1: LNATE for nt  
matrix lb_LNATE_nt=b[1,40]'
matrix list lb_LNATE_nt
matrix ub_LNATE_nt=b[1,41]'
matrix list ub_LNATE_nt

matrix Vlb_LNATE_nt=Vb[40,40]
matrix list Vlb_LNATE_nt

matrix Vub_LNATE_nt=Vb[41,41]
matrix list Vub_LNATE_nt

set seed 1989

*This part calculate the 95% CI
CLR lb_LNATE_nt Vlb_LNATE_nt ub_LNATE_nt Vub_LNATE_nt N 100000 0.05
mat Lb_LNATE_nt_95=e(Lstar)
mat list Lb_LNATE_nt_95
mat Ub_LNATE_nt_95=e(Ustar)
mat list Ub_LNATE_nt_95
mat CILb_LNATE_nt_95=e(CIL)
mat list CILb_LNATE_nt_95
mat CIUb_LNATE_nt_95=e(CIU)
mat list CIUb_LNATE_nt_95

*This part calculate the 90% CI
CLR lb_LNATE_nt Vlb_LNATE_nt ub_LNATE_nt Vub_LNATE_nt N 100000 0.1
mat Lb_LNATE_nt_90=e(Lstar)
mat list Lb_LNATE_nt_90
mat Ub_LNATE_nt_90=e(Ustar)
mat list Ub_LNATE_nt_90
mat CILb_LNATE_nt_90=e(CIL)
mat list CILb_LNATE_nt_90
mat CIUb_LNATE_nt_90=e(CIU)
mat list CIUb_LNATE_nt_90

*This part compute the p-value of the CI excluding zero

qui CLR lb_LNATE_nt Vlb_LNATE_nt ub_LNATE_nt Vub_LNATE_nt N 100000 0.3
mat Lb_LNATE_nt_300=e(Lstar)
mat list Lb_LNATE_nt_300
mat CILb_LNATE_nt_300=e(CIL)
mat list CILb_LNATE_nt_300
mat Ub_LNATE_nt_300=e(Ustar)
mat list Ub_LNATE_nt_300
mat CIUb_LNATE_nt_300=e(CIU)
mat list CIUb_LNATE_nt_300

local alpha=0.3
local alpha1000=`alpha'*1000 

local Lb_LNATE_nt_`alpha1000'=Lb_LNATE_nt_`alpha1000'[1,1]
local CILb_LNATE_nt_`alpha1000'=CILb_LNATE_nt_`alpha1000'[1,1]
local Ub_LNATE_nt_`alpha1000'=Ub_LNATE_nt_`alpha1000'[1,1]
local CIUb_LNATE_nt_`alpha1000'=CIUb_LNATE_nt_`alpha1000'[1,1]

*set pvalue=1
local pvalue=1

if `Lb_LNATE_nt_`alpha1000''>0 {

while `CILb_LNATE_nt_`alpha1000''>0 {
local alpha=`alpha'-0.001
local alpha1000=`alpha'*1000
di "Testing at level of `alpha'/2"
qui CLR lb_LNATE_nt Vlb_LNATE_nt ub_LNATE_nt Vub_LNATE_nt N 100000 `alpha'
mat Lb_LNATE_nt_`alpha1000'=e(Lstar)
mat list Lb_LNATE_nt_`alpha1000'
mat CILb_LNATE_nt_`alpha1000'=e(CIL)
mat list CILb_LNATE_nt_`alpha1000'
local CILb_LNATE_nt_`alpha1000'=CILb_LNATE_nt_`alpha1000'[1,1]
      }
local pvalue=(`alpha'+0.001)	  
display "the CI of the lower bound excludes zero at the level of `pvalue'" 
   } 
else {
if `Ub_LNATE_nt_`alpha1000''<0 {

while `CIUb_LNATE_nt_`alpha1000''<0 {
local alpha=`alpha'-0.001
local alpha1000=`alpha'*1000
di "Testing at level of `alpha'/2"
qui CLR lb_LNATE_nt Vlb_LNATE_nt ub_LNATE_nt Vub_LNATE_nt N 100000 `alpha'
mat Ub_LNATE_nt_`alpha1000'=e(Ustar)
mat list Ub_LNATE_nt_`alpha1000'
mat CIUb_LNATE_nt_`alpha1000'=e(CIU)
mat list CIUb_LNATE_nt_`alpha1000'
local CIUb_LNATE_nt_`alpha1000'=CIUb_LNATE_nt_`alpha1000'[1,1]
      }
local pvalue=(`alpha'+0.001)	  
display "the CI of the upper bound excludes zero at the level of `pvalue'" 
   } 
}

*Generate variables needed for the figure 
*X-axis
gen GROUP=`i'
*Scatter points
gen AVG=b[1,20]
gen EY_00=b[1,23]
gen LATE_perc=Lb_LNATE_nt_95[1,1]/EY_00
gen L_Lnt=Lb_LNATE_nt_95[1,1]
gen U_Lnt=Ub_LNATE_nt_95[1,1]
gen CI_L_Lnt_95=CILb_LNATE_nt_95[1,1]
gen CI_U_Lnt_95=CIUb_LNATE_nt_95[1,1]
gen CI_L_Lnt_90=CILb_LNATE_nt_90[1,1]
gen CI_U_Lnt_90=CIUb_LNATE_nt_90[1,1]
gen pvalue=`pvalue'

keep GROUP AVG EY_00 LATE_perc L_Lnt U_Lnt CI_L_Lnt_95 CI_U_Lnt_95 CI_L_Lnt_90 CI_U_Lnt_90 pvalue

save Figure_`outcome'_`race'_4852, replace

local i=`i'+2
                                   }
				}  








**Nonviolent outcomes 
local i=2
foreach outcome in $outcomes2 {
  /* The white bar   */  
use vc_`outcome'_ygroup2_white_nonwhite_test_I2_be, clear
qui bstat using vc_`outcome'_ygroup2_white_nonwhite_test_I2_be
set more off

estat bootstrap,per

matrix b = e(b)
mat list b

matrix Vb = e(V)
matrix se = e(se)

sca N=b[1,1]
sca list N
set more off

*P1: LNATE for nt  
matrix lb_LNATE_nt=b[1,24]'
matrix list lb_LNATE_nt
matrix ub_LNATE_nt=b[1,25]'
matrix list ub_LNATE_nt

matrix Vlb_LNATE_nt=Vb[24,24]
matrix list Vlb_LNATE_nt

matrix Vub_LNATE_nt=Vb[25,25]
matrix list Vub_LNATE_nt

set seed 1989

CLR lb_LNATE_nt Vlb_LNATE_nt ub_LNATE_nt Vub_LNATE_nt N 100000 0.05
mat Lb_LNATE_nt_95=e(Lstar)
mat list Lb_LNATE_nt_95
mat Ub_LNATE_nt_95=e(Ustar)
mat list Ub_LNATE_nt_95
mat CILb_LNATE_nt_95=e(CIL)
mat list CILb_LNATE_nt_95
mat CIUb_LNATE_nt_95=e(CIU)
mat list CIUb_LNATE_nt_95

CLR lb_LNATE_nt Vlb_LNATE_nt ub_LNATE_nt Vub_LNATE_nt N 100000 0.1
mat Lb_LNATE_nt_90=e(Lstar)
mat list Lb_LNATE_nt_90
mat Ub_LNATE_nt_90=e(Ustar)
mat list Ub_LNATE_nt_90
mat CILb_LNATE_nt_90=e(CIL)
mat list CILb_LNATE_nt_90
mat CIUb_LNATE_nt_90=e(CIU)
mat list CIUb_LNATE_nt_90

*This part compute the p-value of the CI excluding zero

qui CLR lb_LNATE_nt Vlb_LNATE_nt ub_LNATE_nt Vub_LNATE_nt N 100000 0.3
mat Lb_LNATE_nt_300=e(Lstar)
mat list Lb_LNATE_nt_300
mat CILb_LNATE_nt_300=e(CIL)
mat list CILb_LNATE_nt_300
mat Ub_LNATE_nt_300=e(Ustar)
mat list Ub_LNATE_nt_300
mat CIUb_LNATE_nt_300=e(CIU)
mat list CIUb_LNATE_nt_300

local alpha=0.3
local alpha1000=`alpha'*1000 

local Lb_LNATE_nt_`alpha1000'=Lb_LNATE_nt_`alpha1000'[1,1]
local CILb_LNATE_nt_`alpha1000'=CILb_LNATE_nt_`alpha1000'[1,1]
local Ub_LNATE_nt_`alpha1000'=Ub_LNATE_nt_`alpha1000'[1,1]
local CIUb_LNATE_nt_`alpha1000'=CIUb_LNATE_nt_`alpha1000'[1,1]

*set pvalue=1
local pvalue=1

if `Lb_LNATE_nt_`alpha1000''>0 {

while `CILb_LNATE_nt_`alpha1000''>0 {
local alpha=`alpha'-0.001
local alpha1000=`alpha'*1000
di "Testing at level of `alpha'/2"
qui CLR lb_LNATE_nt Vlb_LNATE_nt ub_LNATE_nt Vub_LNATE_nt N 100000 `alpha'
mat Lb_LNATE_nt_`alpha1000'=e(Lstar)
mat list Lb_LNATE_nt_`alpha1000'
mat CILb_LNATE_nt_`alpha1000'=e(CIL)
mat list CILb_LNATE_nt_`alpha1000'
local CILb_LNATE_nt_`alpha1000'=CILb_LNATE_nt_`alpha1000'[1,1]
      }
local pvalue=(`alpha'+0.001)	  
display "the CI of the lower bound excludes zero at the level of `pvalue'" 
   } 
else {
if `Ub_LNATE_nt_`alpha1000''<0 {

while `CIUb_LNATE_nt_`alpha1000''<0 {
local alpha=`alpha'-0.001
local alpha1000=`alpha'*1000
di "Testing at level of `alpha'/2"
qui CLR lb_LNATE_nt Vlb_LNATE_nt ub_LNATE_nt Vub_LNATE_nt N 100000 `alpha'
mat Ub_LNATE_nt_`alpha1000'=e(Ustar)
mat list Ub_LNATE_nt_`alpha1000'
mat CIUb_LNATE_nt_`alpha1000'=e(CIU)
mat list CIUb_LNATE_nt_`alpha1000'
local CIUb_LNATE_nt_`alpha1000'=CIUb_LNATE_nt_`alpha1000'[1,1]
      }
local pvalue=(`alpha'+0.001)	  
display "the CI of the upper bound excludes zero at the level of `pvalue'" 
   } 
}


*Generate variables needed for the figure 
*X-axis
gen GROUP=`i'
*Scatter points
gen AVG=b[1,4]
gen EY_00=b[1,7]
gen LATE_perc=Lb_LNATE_nt_95[1,1]/EY_00
gen L_Lnt=Lb_LNATE_nt_95[1,1]
gen U_Lnt=Ub_LNATE_nt_95[1,1]
gen CI_L_Lnt_95=CILb_LNATE_nt_95[1,1]
gen CI_U_Lnt_95=CIUb_LNATE_nt_95[1,1]
gen CI_L_Lnt_90=CILb_LNATE_nt_90[1,1]
gen CI_U_Lnt_90=CIUb_LNATE_nt_90[1,1]
gen pvalue=`pvalue'

keep GROUP AVG EY_00 LATE_perc L_Lnt U_Lnt CI_L_Lnt_95 CI_U_Lnt_95 CI_L_Lnt_90 CI_U_Lnt_90 pvalue

save Figure_`outcome'_1_4850, replace
 
 /* The nonwhite bar   */  
use vc_`outcome'_ygroup2_white_nonwhite_test_I2_be, clear
qui bstat using vc_`outcome'_ygroup2_white_nonwhite_test_I2_be
set more off

estat bootstrap,per

matrix b = e(b)
mat list b

matrix Vb = e(V)
matrix se = e(se)

sca N=b[1,465]
sca list N
set more off

*P1: LNATE for nt  
matrix lb_LNATE_nt=b[1,488]'
matrix list lb_LNATE_nt
matrix ub_LNATE_nt=b[1,489]'
matrix list ub_LNATE_nt

matrix Vlb_LNATE_nt=Vb[488,488]
matrix list Vlb_LNATE_nt

matrix Vub_LNATE_nt=Vb[489,489]
matrix list Vub_LNATE_nt

set seed 1989

CLR lb_LNATE_nt Vlb_LNATE_nt ub_LNATE_nt Vub_LNATE_nt N 100000 0.05
mat Lb_LNATE_nt_95=e(Lstar)
mat list Lb_LNATE_nt_95
mat Ub_LNATE_nt_95=e(Ustar)
mat list Ub_LNATE_nt_95
mat CILb_LNATE_nt_95=e(CIL)
mat list CILb_LNATE_nt_95
mat CIUb_LNATE_nt_95=e(CIU)
mat list CIUb_LNATE_nt_95

CLR lb_LNATE_nt Vlb_LNATE_nt ub_LNATE_nt Vub_LNATE_nt N 100000 0.1
mat Lb_LNATE_nt_90=e(Lstar)
mat list Lb_LNATE_nt_90
mat Ub_LNATE_nt_90=e(Ustar)
mat list Ub_LNATE_nt_90
mat CILb_LNATE_nt_90=e(CIL)
mat list CILb_LNATE_nt_90
mat CIUb_LNATE_nt_90=e(CIU)
mat list CIUb_LNATE_nt_90

*This part compute the p-value of the CI excluding zero

qui CLR lb_LNATE_nt Vlb_LNATE_nt ub_LNATE_nt Vub_LNATE_nt N 100000 0.3
mat Lb_LNATE_nt_300=e(Lstar)
mat list Lb_LNATE_nt_300
mat CILb_LNATE_nt_300=e(CIL)
mat list CILb_LNATE_nt_300
mat Ub_LNATE_nt_300=e(Ustar)
mat list Ub_LNATE_nt_300
mat CIUb_LNATE_nt_300=e(CIU)
mat list CIUb_LNATE_nt_300

local alpha=0.3
local alpha1000=`alpha'*1000 

local Lb_LNATE_nt_`alpha1000'=Lb_LNATE_nt_`alpha1000'[1,1]
local CILb_LNATE_nt_`alpha1000'=CILb_LNATE_nt_`alpha1000'[1,1]
local Ub_LNATE_nt_`alpha1000'=Ub_LNATE_nt_`alpha1000'[1,1]
local CIUb_LNATE_nt_`alpha1000'=CIUb_LNATE_nt_`alpha1000'[1,1]

*set pvalue=1
local pvalue=1

if `Lb_LNATE_nt_`alpha1000''>0 {

while `CILb_LNATE_nt_`alpha1000''>0 {
local alpha=`alpha'-0.001
local alpha1000=`alpha'*1000
di "Testing at level of `alpha'/2"
qui CLR lb_LNATE_nt Vlb_LNATE_nt ub_LNATE_nt Vub_LNATE_nt N 100000 `alpha'
mat Lb_LNATE_nt_`alpha1000'=e(Lstar)
mat list Lb_LNATE_nt_`alpha1000'
mat CILb_LNATE_nt_`alpha1000'=e(CIL)
mat list CILb_LNATE_nt_`alpha1000'
local CILb_LNATE_nt_`alpha1000'=CILb_LNATE_nt_`alpha1000'[1,1]
      }
local pvalue=(`alpha'+0.001)	  
display "the CI of the lower bound excludes zero at the level of `pvalue'" 
   } 
else {
if `Ub_LNATE_nt_`alpha1000''<0 {

while `CIUb_LNATE_nt_`alpha1000''<0 {
local alpha=`alpha'-0.001
local alpha1000=`alpha'*1000
di "Testing at level of `alpha'/2"
qui CLR lb_LNATE_nt Vlb_LNATE_nt ub_LNATE_nt Vub_LNATE_nt N 100000 `alpha'
mat Ub_LNATE_nt_`alpha1000'=e(Ustar)
mat list Ub_LNATE_nt_`alpha1000'
mat CIUb_LNATE_nt_`alpha1000'=e(CIU)
mat list CIUb_LNATE_nt_`alpha1000'
local CIUb_LNATE_nt_`alpha1000'=CIUb_LNATE_nt_`alpha1000'[1,1]
      }
local pvalue=(`alpha'+0.001)	  
display "the CI of the upper bound excludes zero at the level of `pvalue'" 
   } 
}


*Generate variables needed for the figure 
*X-axis
gen GROUP=`i'
*Scatter points
gen AVG=b[1,468]
gen EY_00=b[1,471]
gen LATE_perc=Lb_LNATE_nt_95[1,1]/EY_00
gen L_Lnt=Lb_LNATE_nt_95[1,1]
gen U_Lnt=Ub_LNATE_nt_95[1,1]
gen CI_L_Lnt_95=CILb_LNATE_nt_95[1,1]
gen CI_U_Lnt_95=CIUb_LNATE_nt_95[1,1]
gen CI_L_Lnt_90=CILb_LNATE_nt_90[1,1]
gen CI_U_Lnt_90=CIUb_LNATE_nt_90[1,1]
gen pvalue=`pvalue'

keep GROUP AVG EY_00 LATE_perc L_Lnt U_Lnt CI_L_Lnt_95 CI_U_Lnt_95 CI_L_Lnt_90 CI_U_Lnt_90 pvalue

save Figure_`outcome'_0_4850, replace
 
local i=`i'+2
 }
				
				
*Panel A: white crime 1948-1952			
*Step 2: Collect data for each figures within the same graph  				
use Figure_currentViolent_1, clear 
append using Figure_nonviolent_new_1
append using Figure_violent_desistence_1
append using Figure_nonviolent_desistance_1 

collapse (mean) AVG EY_00 LATE_perc L_Lnt U_Lnt CI_L_Lnt_95 CI_U_Lnt_95 CI_L_Lnt_90 CI_U_Lnt_90 pvalue, by(GROUP)
label define groupname 1 "Violent Crime" 2 "Nonviolent Crime" 3 "Violent Recidivism" 4 "Nonviolent Recidivism"
label values GROUP groupname 

gen PP_AVG=AVG*100 
gen PP_EY_00=EY_00*100
gen PP_LATE_perc=LATE_perc*100 
gen PP_L_Lnt=L_Lnt*100
gen PP_U_Lnt=U_Lnt*100
gen PP_CI_L_Lnt_95=CI_L_Lnt_95*100
gen PP_CI_U_Lnt_95=CI_U_Lnt_95*100 
gen PP_CI_L_Lnt_90=CI_L_Lnt_90*100 
gen PP_CI_U_Lnt_90=CI_U_Lnt_90*100

*Step 3: Plot the scatter plot 
twoway (rbar PP_U_Lnt PP_L_Lnt GROUP, barwidth(0.5) color(gray) yline(0, lcolor(black)) xlab(1(1)4, valuelabel labsize(small))), ylabel( -0.1(0.1)0.2, labsize(small) grid glcolor(black) glpattern(dot)) /// 
legend (order(1 "The Effect Upper and Lower Bounds" 2 "90% CI" 3 "95% CI" 4 "E[Y|D=0, Z=0]" ))  ///    ///   
title("Panel (A) White Draft Avoiders Born in 1948-1952", size(small)) ///
xtitle("") ///
graphregion(color(white)) ///
|| (rcap PP_CI_U_Lnt_95 PP_CI_L_Lnt_95 GROUP, msize(vhuge) lw(vvthin) msize(vlarge) lwidth(median) color(black)) ///
|| (rcap PP_CI_U_Lnt_90 PP_CI_L_Lnt_90 GROUP, msize(vhuge) lw(vvthin) msize(vlarge) lwidth(median) color(black)) ///
|| (scatter PP_EY_00 GROUP, msymbol(*) color(black) msize(vvlarge) mlw(thick))

graph save Figure_D_1_1, replace 

			
*Panel B: nonwhite crime 1948-1952
*Step 2: Collect data for each figures within the same graph  				
use Figure_currentViolent_0, clear 
append using Figure_nonviolent_new_0
append using Figure_violent_desistence_0
append using Figure_nonviolent_desistance_0 

collapse (mean) AVG EY_00 LATE_perc L_Lnt U_Lnt CI_L_Lnt_95 CI_U_Lnt_95 CI_L_Lnt_90 CI_U_Lnt_90 pvalue, by(GROUP)
label define groupname 1 "Violent Crime" 2 "Nonviolent Crime" 3 "Violent Recidivism" 4 "Nonviolent Recidivism"
label values GROUP groupname 

gen PP_AVG=AVG*100 
gen PP_EY_00=EY_00*100
gen PP_LATE_perc=LATE_perc*100 
gen PP_L_Lnt=L_Lnt*100
gen PP_U_Lnt=U_Lnt*100
gen PP_CI_L_Lnt_95=CI_L_Lnt_95*100
gen PP_CI_U_Lnt_95=CI_U_Lnt_95*100 
gen PP_CI_L_Lnt_90=CI_L_Lnt_90*100 
gen PP_CI_U_Lnt_90=CI_U_Lnt_90*100

*Step 3: Plot the scatter plot 
twoway (rbar PP_U_Lnt PP_L_Lnt GROUP, barwidth(0.5) color(gray) yline(0, lcolor(black)) xlab(1(1)4, valuelabel labsize(small))), ylabel( -1(1)2, labsize(small) grid glcolor(black) glpattern(dot)) /// 
legend (order(1 "The Effect Upper and Lower Bounds" 2 "90% CI" 3 "95% CI" 4 "E[Y|D=0, Z=0]" ))  ///      
title("Panel (B) Nonwhite Draft Avoiders Born in 1948-1952", size(small)) ///
xtitle("") ///
graphregion(color(white)) ///
|| (rcap PP_CI_U_Lnt_95 PP_CI_L_Lnt_95 GROUP, msize(vhuge) lw(vvthin) msize(vlarge) lwidth(median) color(black)) ///
|| (rcap PP_CI_U_Lnt_90 PP_CI_L_Lnt_90 GROUP, msize(vhuge) lw(vvthin) msize(vlarge) lwidth(median) color(black)) ///
|| (scatter PP_EY_00 GROUP, msymbol(*) color(black) msize(vvlarge) mlw(thick))

graph save Figure_D_0_1, replace 
				
					
*Panel C: white crime 1948-1950			
*Step 2: Collect data for each figures within the same graph  				
use Figure_currentViolent_1_4850, clear 
append using Figure_nonviolent_new_1_4850
append using Figure_violent_desistence_1_4850
append using Figure_nonviolent_desistance_1_4850 

collapse (mean) AVG EY_00 LATE_perc L_Lnt U_Lnt CI_L_Lnt_95 CI_U_Lnt_95 CI_L_Lnt_90 CI_U_Lnt_90 pvalue, by(GROUP)
label define groupname 1 "Violent Crime" 2 "Nonviolent Crime" 3 "Violent Recidivism" 4 "Nonviolent Recidivism"
label values GROUP groupname 

gen PP_AVG=AVG*100 
gen PP_EY_00=EY_00*100
gen PP_LATE_perc=LATE_perc*100 
gen PP_L_Lnt=L_Lnt*100
gen PP_U_Lnt=U_Lnt*100
gen PP_CI_L_Lnt_95=CI_L_Lnt_95*100
gen PP_CI_U_Lnt_95=CI_U_Lnt_95*100 
gen PP_CI_L_Lnt_90=CI_L_Lnt_90*100 
gen PP_CI_U_Lnt_90=CI_U_Lnt_90*100

*Step 3: Plot the scatter plot 
twoway (rbar PP_U_Lnt PP_L_Lnt GROUP, barwidth(0.5) color(gray) yline(0, lcolor(black)) xlab(1(1)4, valuelabel labsize(small))), ylabel( -0.1(0.1)0.3, labsize(small) grid glcolor(black) glpattern(dot)) /// 
legend (order(1 "The Effect Upper and Lower Bounds" 2 "90% CI" 3 "95% CI" 4 "E[Y|D=0, Z=0]" ))  ///    
title("Panel (C) White Draft Avoiders Born in 1948-1950", size(small)) ///
xtitle("") ///
graphregion(color(white)) ///
|| (rcap PP_CI_U_Lnt_95 PP_CI_L_Lnt_95 GROUP, msize(vhuge) lw(vvthin) msize(vlarge) lwidth(median) color(black)) ///
|| (rcap PP_CI_U_Lnt_90 PP_CI_L_Lnt_90 GROUP, msize(vhuge) lw(vvthin) msize(vlarge) lwidth(median) color(black)) ///
|| (scatter PP_EY_00 GROUP, msymbol(*) color(black) msize(vvlarge) mlw(thick))

graph save Figure_D_1_2, replace 

			
*Panel D: nonwhite crime 1948-1950
*Step 2: Collect data for each figures within the same graph  				
use Figure_currentViolent_0_4850, clear 
append using Figure_nonviolent_new_0_4850
append using Figure_violent_desistence_0_4850
append using Figure_nonviolent_desistance_0_4850 

collapse (mean) AVG EY_00 LATE_perc L_Lnt U_Lnt CI_L_Lnt_95 CI_U_Lnt_95 CI_L_Lnt_90 CI_U_Lnt_90 pvalue, by(GROUP)
label define groupname 1 "Violent Crime" 2 "Nonviolent Crime" 3 "Violent Recidivism" 4 "Nonviolent Recidivism"
label values GROUP groupname 

gen PP_AVG=AVG*100 
gen PP_EY_00=EY_00*100
gen PP_LATE_perc=LATE_perc*100 
gen PP_L_Lnt=L_Lnt*100
gen PP_U_Lnt=U_Lnt*100
gen PP_CI_L_Lnt_95=CI_L_Lnt_95*100
gen PP_CI_U_Lnt_95=CI_U_Lnt_95*100 
gen PP_CI_L_Lnt_90=CI_L_Lnt_90*100 
gen PP_CI_U_Lnt_90=CI_U_Lnt_90*100

*Step 3: Plot the scatter plot 
twoway (rbar PP_U_Lnt PP_L_Lnt GROUP, barwidth(0.5) color(gray) yline(0, lcolor(black)) xlab(1(1)4, valuelabel labsize(small))), ylabel( -1(1)2, labsize(small) grid glcolor(black) glpattern(dot)) /// 
legend (order(1 "The Effect Upper and Lower Bounds" 2 "90% CI" 3 "95% CI" 4 "E[Y|D=0, Z=0]" ))  ///   
title("Panel (D) Nonwhite Draft Avoiders Born in 1948-1950", size(small)) ///
xtitle("") ///
graphregion(color(white)) ///
|| (rcap PP_CI_U_Lnt_95 PP_CI_L_Lnt_95 GROUP, msize(vhuge) lw(vvthin) msize(vlarge) lwidth(median) color(black)) ///
|| (rcap PP_CI_U_Lnt_90 PP_CI_L_Lnt_90 GROUP, msize(vhuge) lw(vvthin) msize(vlarge) lwidth(median) color(black)) ///
|| (scatter PP_EY_00 GROUP, msymbol(*) color(black) msize(vvlarge) mlw(thick))

graph save Figure_D_0_2, replace 			
				
*Panel E: white crime 1950			
*Step 2: Collect data for each figures within the same graph  				
use Figure_currentViolent_1_1950, clear 
append using Figure_nonviolent_new_1_1950
append using Figure_violent_desistence_1_1950
append using Figure_nonviolent_desistance_1_1950 

collapse (mean) AVG EY_00 LATE_perc L_Lnt U_Lnt CI_L_Lnt_95 CI_U_Lnt_95 CI_L_Lnt_90 CI_U_Lnt_90 pvalue, by(GROUP)
label define groupname 1 "Violent Crime" 2 "Nonviolent Crime" 3 "Violent Recidivism" 4 "Nonviolent Recidivism"
label values GROUP groupname 

gen PP_AVG=AVG*100 
gen PP_EY_00=EY_00*100
gen PP_LATE_perc=LATE_perc*100 
gen PP_L_Lnt=L_Lnt*100
gen PP_U_Lnt=U_Lnt*100
gen PP_CI_L_Lnt_95=CI_L_Lnt_95*100
gen PP_CI_U_Lnt_95=CI_U_Lnt_95*100 
gen PP_CI_L_Lnt_90=CI_L_Lnt_90*100 
gen PP_CI_U_Lnt_90=CI_U_Lnt_90*100

*Step 3: Plot the scatter plot 
twoway (rbar PP_U_Lnt PP_L_Lnt GROUP, barwidth(0.5) color(gray) yline(0, lcolor(black)) xlab(1(1)4, valuelabel labsize(small))), ylabel( -0.1(0.1)0.3, labsize(small) grid glcolor(black) glpattern(dot)) /// 
legend (order(1 "The Effect Upper and Lower Bounds" 2 "90% CI" 3 "95% CI" 4 "E[Y|D=0, Z=0]" ))  ///
title("Panel (E) White Draft Avoiders Born in 1950", size(small)) ///
xtitle("") ///
graphregion(color(white)) ///
|| (rcap PP_CI_U_Lnt_95 PP_CI_L_Lnt_95 GROUP, msize(vhuge) lw(vvthin) msize(vlarge) lwidth(median) color(black)) ///
|| (rcap PP_CI_U_Lnt_90 PP_CI_L_Lnt_90 GROUP, msize(vhuge) lw(vvthin) msize(vlarge) lwidth(median) color(black)) ///
|| (scatter PP_EY_00 GROUP, msymbol(*) color(black) msize(vvlarge) mlw(thick))

graph save Figure_D_1_3, replace 

			
*Panel F: nonwhite crime 1950		
*Step 2: Collect data for each figures within the same graph  				
use Figure_currentViolent_0_1950, clear 
append using Figure_nonviolent_new_0_1950
append using Figure_violent_desistence_0_1950
append using Figure_nonviolent_desistance_0_1950 

collapse (mean) AVG EY_00 LATE_perc L_Lnt U_Lnt CI_L_Lnt_95 CI_U_Lnt_95 CI_L_Lnt_90 CI_U_Lnt_90 pvalue, by(GROUP)
label define groupname 1 "Violent Crime" 2 "Nonviolent Crime" 3 "Violent Recidivism" 4 "Nonviolent Recidivism"
label values GROUP groupname 


gen PP_AVG=AVG*100 
gen PP_EY_00=EY_00*100
gen PP_LATE_perc=LATE_perc*100 
gen PP_L_Lnt=L_Lnt*100
gen PP_U_Lnt=U_Lnt*100
gen PP_CI_L_Lnt_95=CI_L_Lnt_95*100
gen PP_CI_U_Lnt_95=CI_U_Lnt_95*100 
gen PP_CI_L_Lnt_90=CI_L_Lnt_90*100 
gen PP_CI_U_Lnt_90=CI_U_Lnt_90*100

*Step 3: Plot the scatter plot 
twoway (rbar PP_U_Lnt PP_L_Lnt GROUP, barwidth(0.5) color(gray) yline(0, lcolor(black)) xlab(1(1)4, valuelabel labsize(small))), ylabel( -1(1)2, labsize(small) grid glcolor(black) glpattern(dot)) /// 
legend (order(1 "The Effect Upper and Lower Bounds" 2 "90% CI" 3 "95% CI" 4 "E[Y|D=0, Z=0]" ))  ///
title("Panel (F) Nonwhite Draft Avoiders Born in 1950", size(small)) ///
xtitle("") ///
graphregion(color(white)) ///
|| (rcap PP_CI_U_Lnt_95 PP_CI_L_Lnt_95 GROUP, msize(vhuge) lw(vvthin) msize(vlarge) lwidth(median) color(black)) ///
|| (rcap PP_CI_U_Lnt_90 PP_CI_L_Lnt_90 GROUP, msize(vhuge) lw(vvthin) msize(vlarge) lwidth(median) color(black)) ///
|| (scatter PP_EY_00 GROUP, msymbol(*) color(black) msize(vvlarge) mlw(thick))

graph save Figure_D_0_3, replace 

			
*Panel G: white crime 1951			
*Step 2: Collect data for each figures within the same graph  				
use Figure_currentViolent_1_1951, clear 
append using Figure_nonviolent_new_1_1951
append using Figure_violent_desistence_1_1951
append using Figure_nonviolent_desistance_1_1951 

collapse (mean) AVG EY_00 LATE_perc L_Lnt U_Lnt CI_L_Lnt_95 CI_U_Lnt_95 CI_L_Lnt_90 CI_U_Lnt_90 pvalue, by(GROUP)
label define groupname 1 "Violent Crime" 2 "Nonviolent Crime" 3 "Violent Recidivism" 4 "Nonviolent Recidivism"
label values GROUP groupname 

gen PP_AVG=AVG*100 
gen PP_EY_00=EY_00*100
gen PP_LATE_perc=LATE_perc*100 
gen PP_L_Lnt=L_Lnt*100
gen PP_U_Lnt=U_Lnt*100
gen PP_CI_L_Lnt_95=CI_L_Lnt_95*100
gen PP_CI_U_Lnt_95=CI_U_Lnt_95*100 
gen PP_CI_L_Lnt_90=CI_L_Lnt_90*100 
gen PP_CI_U_Lnt_90=CI_U_Lnt_90*100

*Step 3: Plot the scatter plot 
twoway (rbar PP_U_Lnt PP_L_Lnt GROUP, barwidth(0.5) color(gray) yline(0, lcolor(black)) xlab(1(1)4, valuelabel labsize(small))), ylabel( -0.1(0.1)0.3, labsize(small) grid glcolor(black) glpattern(dot)) /// 
legend (order(1 "The Effect Upper and Lower Bounds" 2 "90% CI" 3 "95% CI" 4 "E[Y|D=0, Z=0]" ))  ///
title("Panel (G) White Draft Avoiders Born in 1951", size(small)) ///
xtitle("") ///
graphregion(color(white)) ///
|| (rcap PP_CI_U_Lnt_95 PP_CI_L_Lnt_95 GROUP, msize(vhuge) lw(vvthin) msize(vlarge) lwidth(median) color(black)) ///
|| (rcap PP_CI_U_Lnt_90 PP_CI_L_Lnt_90 GROUP, msize(vhuge) lw(vvthin) msize(vlarge) lwidth(median) color(black)) ///
|| (scatter PP_EY_00 GROUP, msymbol(*) color(black) msize(vvlarge) mlw(thick))

graph save Figure_D_1_4, replace 

			
*Panel H: nonwhite crime 1951		
*Step 2: Collect data for each figures within the same graph  				
use Figure_currentViolent_0_1951, clear 
append using Figure_nonviolent_new_0_1951
append using Figure_violent_desistence_0_1951 
append using Figure_nonviolent_desistance_0_1951 

collapse (mean) AVG EY_00 LATE_perc L_Lnt U_Lnt CI_L_Lnt_95 CI_U_Lnt_95 CI_L_Lnt_90 CI_U_Lnt_90 pvalue, by(GROUP)
label define groupname 1 "Violent Crime" 2 "Nonviolent Crime" 3 "Violent Recidivism" 4 "Nonviolent Recidivism"
label values GROUP groupname 

gen PP_AVG=AVG*100 
gen PP_EY_00=EY_00*100
gen PP_LATE_perc=LATE_perc*100 
gen PP_L_Lnt=L_Lnt*100
gen PP_U_Lnt=U_Lnt*100
gen PP_CI_L_Lnt_95=CI_L_Lnt_95*100
gen PP_CI_U_Lnt_95=CI_U_Lnt_95*100 
gen PP_CI_L_Lnt_90=CI_L_Lnt_90*100 
gen PP_CI_U_Lnt_90=CI_U_Lnt_90*100

*Step 3: Plot the scatter plot 
twoway (rbar PP_U_Lnt PP_L_Lnt GROUP, barwidth(0.5) color(gray) yline(0, lcolor(black)) xlab(1(1)4, valuelabel labsize(small))), ylabel( -1(1)2, labsize(small) grid glcolor(black) glpattern(dot)) /// 
legend (order(1 "The Effect Upper and Lower Bounds" 2 "90% CI" 3 "95% CI" 4 "E[Y|D=0, Z=0]" ))  ///  
title("Panel (H) Nonwhite Draft Avoiders Born in 1951", size(small)) ///
xtitle("") ///
graphregion(color(white)) ///
|| (rcap PP_CI_U_Lnt_95 PP_CI_L_Lnt_95 GROUP, msize(vhuge) lw(vvthin) msize(vlarge) lwidth(median) color(black)) ///
|| (rcap PP_CI_U_Lnt_90 PP_CI_L_Lnt_90 GROUP, msize(vhuge) lw(vvthin) msize(vlarge) lwidth(median) color(black)) ///
|| (scatter PP_EY_00 GROUP, msymbol(*) color(black) msize(vvlarge) mlw(thick))

graph save Figure_D_0_4, replace 


		
*Panel I: white crime 1952			
*Step 2: Collect data for each figures within the same graph  				
use Figure_currentViolent_1_1952, clear 
append using Figure_nonviolent_new_1_1952
append using Figure_violent_desistence_1_1952
append using Figure_nonviolent_desistance_1_1952 

collapse (mean) AVG EY_00 LATE_perc L_Lnt U_Lnt CI_L_Lnt_95 CI_U_Lnt_95 CI_L_Lnt_90 CI_U_Lnt_90 pvalue, by(GROUP)
label define groupname 1 "Violent Crime" 2 "Nonviolent Crime" 3 "Violent Recidivism" 4 "Nonviolent Recidivism"
label values GROUP groupname 

gen PP_AVG=AVG*100 
gen PP_EY_00=EY_00*100
gen PP_LATE_perc=LATE_perc*100 
gen PP_L_Lnt=L_Lnt*100
gen PP_U_Lnt=U_Lnt*100
gen PP_CI_L_Lnt_95=CI_L_Lnt_95*100
gen PP_CI_U_Lnt_95=CI_U_Lnt_95*100 
gen PP_CI_L_Lnt_90=CI_L_Lnt_90*100 
gen PP_CI_U_Lnt_90=CI_U_Lnt_90*100

*Step 3: Plot the scatter plot 
twoway (rbar PP_U_Lnt PP_L_Lnt GROUP, barwidth(0.5) color(gray) yline(0, lcolor(black)) xlab(1(1)4, valuelabel labsize(small))), ylabel( -0.1(0.1)0.3, labsize(small) grid glcolor(black) glpattern(dot)) /// 
legend (order(1 "The Effect Upper and Lower Bounds" 2 "90% CI" 3 "95% CI" 4 "E[Y|D=0, Z=0]" ))  ///  
title("Panel (I) White Draft Avoiders Born in 1952", size(small)) ///
xtitle("") ///
graphregion(color(white)) ///
|| (rcap PP_CI_U_Lnt_95 PP_CI_L_Lnt_95 GROUP, msize(vhuge) lw(vvthin) msize(vlarge) lwidth(median) color(black)) ///
|| (rcap PP_CI_U_Lnt_90 PP_CI_L_Lnt_90 GROUP, msize(vhuge) lw(vvthin) msize(vlarge) lwidth(median) color(black)) ///
|| (scatter PP_EY_00 GROUP, msymbol(*) color(black) msize(vvlarge) mlw(thick))

graph save Figure_D_1_5, replace 

			
*Panel J: nonwhite crime 1952
*Step 2: Collect data for each figures within the same graph  				
use Figure_currentViolent_0_1952, clear 
append using Figure_nonviolent_new_0_1952
append using Figure_violent_desistence_0_1952 
append using Figure_nonviolent_desistance_0_1952 

collapse (mean) AVG EY_00 LATE_perc L_Lnt U_Lnt CI_L_Lnt_95 CI_U_Lnt_95 CI_L_Lnt_90 CI_U_Lnt_90 pvalue, by(GROUP)
label define groupname 1 "Violent Crime" 2 "Nonviolent Crime" 3 "Violent Recidivism" 4 "Nonviolent Recidivism"
label values GROUP groupname 

gen PP_AVG=AVG*100 
gen PP_EY_00=EY_00*100
gen PP_LATE_perc=LATE_perc*100 
gen PP_L_Lnt=L_Lnt*100
gen PP_U_Lnt=U_Lnt*100
gen PP_CI_L_Lnt_95=CI_L_Lnt_95*100
gen PP_CI_U_Lnt_95=CI_U_Lnt_95*100 
gen PP_CI_L_Lnt_90=CI_L_Lnt_90*100 
gen PP_CI_U_Lnt_90=CI_U_Lnt_90*100

*Step 3: Plot the scatter plot 
twoway (rbar PP_U_Lnt PP_L_Lnt GROUP, barwidth(0.5) color(gray) yline(0, lcolor(black)) xlab(1(1)4, valuelabel labsize(small))), ylabel( -1(1)2, labsize(small) grid glcolor(black) glpattern(dot)) /// 
legend (order(1 "The Effect Upper and Lower Bounds" 2 "90% CI" 3 "95% CI" 4 "E[Y|D=0, Z=0]" ))  ///  
title("Panel (J) Nonwhite Draft Avoiders Born in 1952", size(small)) ///
xtitle("") ///
graphregion(color(white)) ///
|| (rcap PP_CI_U_Lnt_95 PP_CI_L_Lnt_95 GROUP, msize(vhuge) lw(vvthin) msize(vlarge) lwidth(median) color(black)) ///
|| (rcap PP_CI_U_Lnt_90 PP_CI_L_Lnt_90 GROUP, msize(vhuge) lw(vvthin) msize(vlarge) lwidth(median) color(black)) ///
|| (scatter PP_EY_00 GROUP, msymbol(*) color(black) msize(vvlarge) mlw(thick))

graph save Figure_D_0_5, replace 


graph combine Figure_D_1_1.gph Figure_D_0_1.gph Figure_D_1_2.gph Figure_D_0_2.gph, rows(2) cols(2) iscale(0.6) ysize(12) xsize(20)
graph combine Figure_D_1_3.gph Figure_D_0_3.gph Figure_D_1_4.gph Figure_D_0_4.gph, rows(2) cols(2) iscale(0.6) ysize(12) xsize(20) 
graph combine Figure_D_1_4.gph Figure_D_0_4.gph Figure_D_1_5.gph Figure_D_0_5.gph, rows(2) cols(2) iscale(0.6) ysize(12) xsize(20) 
